Aron is demonstrating using pandas to read data and plot using matplotlib.
In [12]:
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
In [5]:
# change path as needed.
PATH = 'all_immigrant_probs.csv'
data = pd.read_csv(PATH, header=None)
In [6]:
data.head()
Out[6]:
In [29]:
# plot first two users:
data.iloc[:,[0,1,2]].plot(x=0)
Out[29]:
In [13]:
# plot all users.
data.plot(x=0, legend=False)
plt.xlabel('time from date of immigration')
plt.ylabel('depression probability')
Out[13]:
In [30]:
# plot first 50:
data.iloc[:,range(50)].plot(x=0, legend=False)
plt.xlabel('time from date of immigration')
plt.ylabel('depression probability')
Out[30]:
In [38]:
# plot overall mean.
data.iloc[:,range(1,len(data))].mean(axis=0).plot()
Out[38]: